//
// Created by Zhangwj on 2023/9/27.
//

#include "LAndExpNode.h"

std::unique_ptr<LAndExpNode> LAndExpNode::LAndExpParser(Parser &parser) {
    //LAndExp → EqExp | LAndExp '&&' EqExp
    //改写为 LAndExp -> EqExp { '&&' EqExp }
    std::unique_ptr<LAndExpNode> lAndExpNode = std::make_unique<LAndExpNode>();
    lAndExpNode->EqExps.push_back(EqExpNode::EqExpParser(parser));
    while (parser.getLexType(0) == LexType::AND) {
        parser.next();
        lAndExpNode->EqExps.push_back(EqExpNode::EqExpParser(parser));
    }
    return lAndExpNode;
}
